package cn.cycleif.util;

import cn.hutool.crypto.digest.DigestAlgorithm;
import cn.hutool.crypto.digest.Digester;

/**
 * @Date: 25/1/22-22:43
 * @Desc:
 */
public class EncryptUtil {

  private EncryptUtil() {
  }

  private static final String SALT = "Rjfbfbh6c3jRfe9gilcmhg";

  public static boolean validate(String encrypted, String t2) {
    return encrypted.equals(encrypt(t2));
  }

  public static String encrypt(String password) {
    Digester digester = new Digester(DigestAlgorithm.SHA256);
    return digester.setSalt(SALT.getBytes()).digestHex(password);
  }
}
